package com.zzt.community.util;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.DigestUtils;

import java.nio.charset.StandardCharsets;
import java.util.UUID;

/**
 * Classname: CommunityUtil
 * Package: com.zzt.community.util
 * Description:
 *
 * @Author:zzt
 * @Create: 2024/3/8-14:38
 * Version:
 */
public class CommunityUtil {
    //生成随机的字符串
    public static String generateUUID() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }

    //md5加密 加密一次后不会变化
    //增加随机字符串之后再进行md5加密
    public static String md5(String key){
        if (StringUtils.isBlank(key)){
            return null;
        }
        return DigestUtils.md5DigestAsHex(key.getBytes());

    }

}
